<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">


<ui:composition template="/templates/templateAluno.xhtml">
	<ui:define name="conteudo">
		<h:panelGrid columns="2">
			<h:outputLabel value="Usuário: " />
			<h:outputText value="#{mBIndexAluno.aluno.usuario.nome}" />
			<h:outputLabel value="Turma: " />
			<h:outputText value="#{mBIndexAluno.aluno.turma.nome}" />
		</h:panelGrid>
		<h:form rendered="#{mBIndexAluno.aluno.turma != null}">
			<p:dataTable emptyMessage="Não há turma cadastrada"
				value="#{mBIndexAluno.aluno.turma.aulas}" var="aula" >
				<f:facet name="header">
					Disciplinas
				</f:facet>
				<p:column headerText="Horário">
					<h:outputText value="#{aula.horario}" />
				</p:column>
				<p:column headerText="Professor">
					<p:commandLink value="#{aula.professor.usuario.nome}" action="#{mBProfessor.setarProfessorDialog}" oncomplete="professorDialog.show()" update="@form"> 
						<f:setPropertyActionListener target="#{mBProfessor.professorVizualizacao}" value="#{aula.professor}"/>
					</p:commandLink>
				</p:column>
				<p:column headerText="Sala">
					<h:outputText value="#{aula.sala.nome}" />
				</p:column>
				<p:column headerText="Disciplina">
					<p:commandLink value="#{aula.disciplina.nome}" oncomplete="disciplinaDialog.show()" update="@form">
						<f:setPropertyActionListener target="#{mBDisciplina.disciplinaVisualizacao}" value="#{aula.disciplina}"></f:setPropertyActionListener>
					</p:commandLink>
				</p:column>
				<p:column headerText="Acessar">
					<p:commandButton value="Acessar Turma"
						action="#{mBIndexAluno.irTurma}" ajax="false">
						<f:setPropertyActionListener target="#{mBIndexAluno.idIrAula}"
							value="#{aula.id}" />
					</p:commandButton>
				</p:column>
			</p:dataTable>
			<p:dialog widgetVar="disciplinaDialog" header="Disciplina">
				<ui:include src="../comum/disciplina.xhtml">
					<ui:param name="disciplina" value="#{mBDisciplina.disciplinaVisualizacao}"/>
				</ui:include>
			</p:dialog>
			<p:dialog widgetVar="professorDialog" height="500" header="Professor">
				<ui:include src="../comum/professor.xhtml">
					<ui:param name="professor" value="#{mBProfessor.professorVizualizacao}"/>
				</ui:include>
			</p:dialog>
		</h:form>
		
		<h:form id="Historioco">
			<p:commandButton value="Historico" action="#{mBIndexAluno.imprimirHistorico()}"/>
		</h:form>
		
		<h:form>
			<p:dataTable value="#{mBIndexAluno.avaliacaos}" var="avalicao">
				<f:facet name="header">
					Avaliações
				</f:facet>
				<p:column headerText="Disciplina">
					<h:outputText value="#{avalicao.aula.disciplina.nome}" />
				</p:column>
				<p:column headerText="Data">
					<h:outputText value="#{avalicao.dataFormatada}" />
				</p:column>
				<p:column headerText="Descrição">
					<h:outputText value="#{avalicao.descricao}" />
				</p:column>
			</p:dataTable>
		</h:form>
		
		<h:outputText value="Você não foi inserido em nenhuma turma, entre em contato com a direção ou coordenação de sua escola" rendered="#{mBIndexAluno.aluno.turma == null}" />
	</ui:define>
</ui:composition>
</html>